<?php
class RequiredValidate extends BaseValidate {
	/**
	 * (non-PHPdoc)
	 * @see BaseValidate::v()
	 */
	public function v($val, $langs=null){
		if($val === null){
			return $this->null_error($langs);
		}
			
		if(is_string($val)){
			if($val === null || $val == ''){
				return $this->null_error($langs);
			}
		}elseif(is_array($val)){
			if(count($val) === 0){
				return $this->null_error($langs);
			}
		}
		return true;
	}
	
	private function null_error($langs){
		$this->error = $this->get_item_name($langs) . '不能为空！';
		return false;
	}
}

?>